#ifndef NAME_SPACE_H
#define NAME_SPACE_H

#include <string>
#include <set>

class UniqueName;

// Allows registering and unregistering of UniqueNames

class NameSpace
{
    friend class UniqueName;    // code from an ancient project ... OMG ...

public:

    NameSpace();
    virtual ~NameSpace();

    virtual bool isNameRegistered(const std::string &name);

protected:
    // Creates a name that is not already registered.
    // If name is empty there will be a generic name like "RenameMe1" returned.
    // If name is set, a number is appended at the end of the name and retured (e.g. "MyName4").
    virtual const std::string generateName(
        const std::string &name = ""
    ,   const std::string &ignoreName = "");

    virtual void unregisterName(const std::string &name);
    virtual bool registerName(const std::string &name);

private:
    std::set<std::string> m_names;
    unsigned int m_generatedCount;
};


#endif // NAME_SPACE_H
